﻿using System;
using Quartz;
using Quartz.Impl;

namespace KKCai.TC.Job
{
    public sealed class JobManager
    {
        public static JobManager Instance
        {
            get
            {
                return Nested.JobManager;
            }
        }

        private class Nested
        {
            static Nested() { }
            internal static readonly JobManager JobManager = new JobManager();
        }

        private JobManager()
        {
            sched = new StdSchedulerFactory().GetScheduler();

            JobDetail job = new JobDetail("job", typeof(MyJob));

            CronTrigger trigger = new CronTrigger("name", "group", "0/15 9/10,0/10,1/10 9-23 * * ?");

            sched.ScheduleJob(job, trigger);
        }

        public void Start()
        {
            sched.Start();
        }

        private IScheduler sched;
    }
}
